<template>
    <mescroll-uni
        ref="mescrollRef"
        @init="mescrollInit"
        :height="height"
        :down="downOption"
        @down="downRefresh"
        :up="upOption"
        @up="getData">
        <return-visit-item v-for="(item, index) in datas" :item="item" :key="index"></return-visit-item>
    </mescroll-uni>
</template>

<script>
import returnVisitItem from "@/components/customer/return-visit-item.vue"
import { GetStoreVisitRecord } from "@/service/api/store.js"
export default {
    components: {
        returnVisitItem,
    },
    props: {
        height: {
            type: String,
            default: "300px",
        },
        StoreId: {
            type: String,
            default: "",
        },
        StoreUserId: {
            type: String,
            default: "",
        },
    },
    data() {
        return {
            datas: [],
            param: {
                pageIndex: 1,
                pageSize: 10,
            },
        }
    },
    mounted() {
        this.refresh()
    },
    methods: {
        //获取列表数据
        getData(page) {
            // setTimeout(()=>{
            // 	let res = {
            // 		Data:[
            // 			{
            // 				id:1,
            // 				name:"张小小",
            // 				time:'2021-12-11 10:10:10',
            // 				content:"门店服务非常好，场地大，整洁干净，服务态度和技术都不错。"
            // 			},
            // 			{
            // 				id:2,
            // 				name:"陈大大",
            // 				time:'2021-12-15 10:10:10',
            // 				content:"场地大，整洁干净，服务态度和技术都不错，门店非常漂亮。场地大，整洁干净，服务态度和技术都不错，门店非常漂亮。场地大，整洁干净，服务态度和技术都不错，门店非常漂亮。场地大，整洁干净，服务态度和技术都不错，门店非常漂亮。"
            // 			},
            // 		],
            // 		allLength:1
            // 	}
            // 		this.mescroll.endBySize(1,1);
            // 		this.datas = this.datas.concat(res.Data)
            // },500)

            let path = "?type=0&storeUserId=" + this.StoreUserId
            GetStoreVisitRecord(this.param, path).then((res) => {
                if (res.State == 1) {
                    this.mescroll.endBySize(res.Data.length, res.RecordAmout)
                    this.datas = this.datas.concat(res.Data)
                } else {
                    this.mescroll.endBySize(0, 0)
                    this.easyToast(res.Msg)
                }
            })
        },
        //刷新
        refresh() {
            this.downRefresh()
        },
        //刷新
        downRefresh() {
            this.datas = []
            this.mescroll.resetUpScroll()
        },
    },
}
</script>

<style lang="scss"></style>
